<h2>$.EJS</h2>
<h4>扩展$.EJS对象，自定义公共的格式化方法。</h4>
<p>模板</p>
<pre class="temp"></pre>
<p>代码</p>
<pre class="script"></pre>
<p>输出</p>
<div id="myDiv" ejs>
    <table>
        <tr>
            <th>编号</th>
            <th>订单号</th>
            <th>订单状态</th>
            <th>创建时间</th>
        </tr>
        <tr e-for="i in data">
            <td>{{data[i].id}}</td>
            <td>{{data[i].orderId}}</td>
            <td>{{EJS.orderStatus(data[i].orderStatus)}}</td>
            <td>{{EJS.localDate(data[i].createTime)}}</td>
        </tr>
    </table>
</div>
<br>
<br>
<script src="../js/jquery.min.js"></script>
<script src="../js/ejs.min.js"></script>
<script src="../js/jqejs.js"></script>
<script id="myJs">
$(function() {
    $.EJS.orderStatus = function(status) {
        switch (status) {
            case 'NOTPAY':
                return '未支付';
            case 'USERPAYING':
                return '支付中';
            case 'SUCCESS':
                return '支付成功';
            case 'REFUND':
                return '转入退款';
            case 'PAYERROR':
                return '支付失败';
            case 'CLOSED':
                return '已关闭';
            default:
                return status;
        }
    }
    var orderList = [{
        id: 1,
        orderId: "weg8sd2f1sd8f7sdf",
        orderStatus: 'NOTPAY',
        createTime: 1471080015572
    }, {
        id: 2,
        orderId: "9uw87e4rg15et1ere",
        orderStatus: 'SUCCESS',
        createTime: 1481080015572
    }, {
        id: 3,
        orderId: "etu894r51tesr5t1r",
        orderStatus: 'CLOSED',
        createTime: 1482080015572
    }];
    $('#myDiv').ejs({
        data: orderList
    });
});
</script>
